All Questions
12 questions
0votes
1answer
100views
How to do replace with the dte editor
The dte editor a small and easy to use console text editor. In readme or its online doc, both says: Regex search and replace (are the key features). However, I haven't found how to do the replace ...
0votes
2answers
291views
insert block of lines only before first matched pattern
i need to insert the below lines (after variable substitution) before the first matched string which is server { in /etc/nginx/nginx.conf Variable: website=www.hello.com Block of lines: server { # ...
0votes
1answer
157views
How to replace text in file - conditions and arithmetic required
I need a script to change content in some text files. This a bit beyond my limited bash skills. Maybe perl or python would be a better approach, I have no experience with either of these. I have a ...
0votes
1answer
2kviews
Simple Binary Replacement
I tried using bbe as below bbe -e 's/01110011/01111000/' test.txt All I'm trying to accomplish in this example is to read the file as if it's a binary file, and replacing the letter s with x. I'm ...
2votes
3answers
296views
Replacing two patterns in a text files at the same time [duplicate]
I have a text file contain numbers as follows: 34 77 1716 150?.2 67.5892 11.9691 23 1?6 83 35 78 0 0 0 0 0 0 0 36 79 0 0 0 0 0 0 0 37 80 0 0 ? ? 0 0 0 38 81 0 0 0 ? 0 0 0 39 82 0 0 0 0 ? 0 ? 40 85 ...
0votes
1answer
563views
How to make "incremental" replace in files with bash
I need to search files in directory with specific pattern (for example foobar) and replace them with foobarXXX, where XXX is a number. For example, there were two original file snt130.txt My ...
1vote
2answers
2kviews
replace a block of text with the contents of a file
I would like to replace the contents between $Elements$ and $EndElements$ in text file, f1, with the data from another file, f2. The contents of f1 is given simply by $Elements$ 3 1 5 7 $EndElements$...
3votes
3answers
406views
Replace content inside two specific lines
How to replace, from command-line, the content between <!-- Analytics code start --> and <!-- Analytics code end --> of index.html: <html> ... <!-- Analytics code start --> .....
0votes
1answer
2kviews
Execute command in dynamic directories via shell script
My main directory is /home/hts/.hts/tvheadend/input/dvb/networks/1d38df81855dee2d39e692ecc4caf05c/muxes In there are many more directories with radomly generated names Example: /...
0votes
1answer
83views
Can you replace displayed text with something else in command window?
I am trying to manage user accounts. They are basically just numbers, but I would rather see user last names on the screen. Is it possible to automatically replace displayed text with something else? ...
1vote
1answer
1kviews
How can I find and replace only in a range of columns?
I have a text file with 9267 lines. I want to find "A" with 5 spaces after it and replace it with "A" with 5 spaces before and after it on all lines, but only between columns 67 and 88. Text outside ...
0votes
1answer
73views
text replacing in data file with peculiar spacing
I have a text (.qdp) file with many data stored. In some rows, the data are too many to be on just one line. Then, the program that saves the data, use a minus sign (-) to go on the new line, and ...